<?php

namespace app\service;

use app\exception\ErrnoPlus;
use app\model\EmailLogTableModel;
use share\exception\ApiException;
use share\service\BaseModelService;
use share\utils\Helper;

class EmailLogTableService extends BaseModelService
{
    public static function getModel()
    {
        return new EmailLogTableModel;
    }

    public static function buildCondition($filter)
    {
        $res = [];
        if(isset($filter['email']) && !empty($filter['email'])){
            $res['email'] = ['like',$filter['email']];
        }
        if(isset($filter['startTime']) && !empty($filter['startTime']) && isset($filter['endTime']) && !empty($filter['endTime'])){
            $res['start_time'] = ['between',[$filter['startTime'],$filter['endTime']]];
        }   
        if(isset($filter['sendRes']) && !empty($filter['sendRes'])){
            $res['send_res'] = $filter['sendRes'];
        }
        return $res;
    }
}
